from blinker import signal

# 定义信号
task_done = signal('task-completed')

# 订阅信号
@task_done.connect
def notify_on_completion(sender, **kwargs):
    print(f"Task from {sender} completed!")

@task_done.connect
def notify_on_completion_001(sender, **kwargs):
    print("notify_on_completion_001!")

# 发布信号
task_done.send('background-worker', data={'result': 'success'})



